<template>
  <div>
    <van-nav-bar title="账户资料" @click-left="onClickLeft" left-arrow />

    <div class="set-box">
      <van-cell center is-link value="修改资料">
        <div class="box1">
          <div class="left">
            <!-- 头像 -->
            <van-image
              round
              width="50px"
              height="50px"
              src="https://img01.yzcdn.cn/vant/cat.jpeg"
            />
          </div>
          <div class="right">
            <span>修改头像</span>
          </div>
        </div>
      </van-cell>

      <van-form @submit="onSubmit">
        <van-field
          v-model="username"
          label="用户名"
          placeholder="用户名"
          :rules="[{ required: true, message: '请填写用户名' }]"
        />
        <van-field
          v-model="password"
          type="password"
          label="密码"
          placeholder="密码"
          :rules="[{ required: true, message: '请填写密码' }]"
        />
        <div style="margin: 16px">
          <van-button round block type="info" native-type="submit"
            >保存</van-button
          >
        </div>
      </van-form>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      username: '',
      password: '',
    };
  },
  computed:{
    user(){
      return this.$store.state.person
    }
  },
  methods: {
    onClickLeft() {
      this.$router.back();
    },
    onSubmit(values) {
      console.log('submit', values);
    },
  },
};
</script>
<style lang='scss' scoped>
.van-nav-bar {
  height: 54px;
  line-height: 54px;
  .van-icon {
    color: #333333;
  }
}
.set-box {
  height: 652px;
  background: #f2f2f2;
  padding-top: 10px;
  .van-cell {
    width: 375px;
    height: 62px;
    .box1 {
      display: flex;
      align-items: center;
      margin-left: 5px;
      justify-content: space-between;
      .left {
        display: flex;
        align-items: center;
        .van-image {
          margin-right: 10px;
        }
      }
    }
  }
}
</style>